#include<iostream>
#include<cmath>
using namespace std;
class Complex
{
public:
    Complex(double r=0,double i=0):real(r),imag(i) {}

    void print() const
    {
        cout<< real <<" + " << imag <<"i\n";
    }

    Complex neg() // -
    {
        return Complex(-real, -imag );
    }

    double abscomplex( )
    {
        return sqrt(real*real+imag*imag);
    }

    void add_assignment(Complex cm)// +=
    {
        re+=cm.re;
        im+=cm.im;
    }

private:
    double real;
    double imag;
};

int main()
{
    Complex cm1(1.5),cm2(3,4),cm3,cm4;
    cm3 = cm1.neg();
    cm3.print();
    cm4 = cm2.neg();
    cm4.print();
    cout<<"abs of cm1 is "<<cm1.abscomplex()<<endl;
    cout<<"abs of cm2 is "<<cm2.abscomplex()<<endl;
    cm2.add_assignment(cm1);
    cm2.print();
    return 0;
}
/*
void proComplex(Complex c)
{
    Complex c1(1,-2);
    c.add_assignment(c1);
}

int main()
{
    Complex cm(3,7);
    cm.print();
    proComplex(cm);
    cm.print();

    return 0;
}

*/